﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
//using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UserControl_Test
{
    delegate String GetTextValDelegate();
    delegate void SetTextValDelegate(String text);
    public partial class UserControl1 : UserControl
    {
        private int cIndex;
        public bool clicked;
        public bool inserted;
        private Color classColor;

        //private String GetTextVal()
        //{
        //    if (InvokeRequired)
        //    {
        //        Invoke(new GetTextValDelegate(GetTextVal));
        //        return this.Text_Info;
        //    }
        //    return this.TB_Info.Text;
        //}
        //private void SetTextVal(String text)
        //{
        //    if (InvokeRequired)
        //    {
        //        Invoke(new SetTextValDelegate(SetTextVal),text);
        //        return;
        //    }
        //    this.TB_Info.Text=text;
        //}
        public UserControl1()
        {
            InitializeComponent();
            //this.ResizeRedraw = true;
            cIndex = -1;
            
        }
        public Image Image1
        {
            get
            {
                return this.pictureBox1.Image;
            }
            set
            {
                this.pictureBox1.Image = value;
            }
        }
        public int PicBoxWidth
        {
            get
            {
                return this.groupBox.Width;
            }
            set
            {
                //this.panel1.Width = value;
                this.groupBox.Width = value;
            }
        }
        public int PicBoxHeight
        {
            get
            {
                return this.groupBox.Height;
            }
            set
            {
                //this.panel1.Height = value;
                this.groupBox.Height = value;
            }
        }
        public PictureBoxSizeMode SizeMode
        {
            get
            {
                return this.pictureBox1.SizeMode;
            }
            set
            {
                this.pictureBox1.SizeMode = value;
            }
        }
        public String Text_Box
        {
            get
            {
                return this.groupBox.Text;

            }
            set
            {
                this.groupBox.Text = value;
            }
        }
        public String Text_Width
        {
            get
            {
                return this.TB_Width.Text;
            }
            set
            {
                this.TB_Width.Text = value;
            }
        }
        public String Text_Height
        {
            get
            {
                return this.TB_Height.Text;
            }
            set
            {
                this.TB_Height.Text = value;
            }
        }
        //public String Text_Info
        //{
        //    get
        //    {
        //        return GetTextVal();
        //    }
        //    set
        //    {
        //        SetTextVal(value);
        //    }
        //}
        public String Text_Quality
        {
            get
            {
                return this.TB_Quality.Text;
            }
            set
            {
                this.TB_Quality.Text = value;
            }
        }
        public String Text_Size
        {
            get
            {
                return this.TB_Size.Text;
            }
            set
            {
                this.TB_Size.Text = value;
            }
        }
        public int controlIndex
        {
            get
            {
                return this.cIndex;
            }
            set
            {
                this.cIndex = value;
            }
        }
        public Color classificationColor
        {
            get
            {
                return this.classColor;
            }
            set
            {
                this.classColor = value;
                B_Color.BackColor = value;
            }
        }
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
                clicked = true;
        }

        private void B_Color_Click(object sender, EventArgs e)
        {
            if (colorDialog.ShowDialog() != DialogResult.Cancel)
            {
                B_Color.BackColor = colorDialog.Color;
                classColor = colorDialog.Color;
            }
        }
    }
}
